public class Singletontest05 {
    static {
        System.out.println("线程安全-同步代码块!");
    }

    public static void main(String[] args) throws Exception{
        Singletion05 instance =  Singletion05.getInstance();
        Singletion05 instance2 = Singletion05.getInstance();
        System.out.println(instance == instance2);
        System.out.println(instance.hashCode());
        System.out.println(instance2.hashCode());
    }
}
class Singletion05{
    private static Singletion05 singletion05;
    private Singletion05(){

    }
    public static Singletion05 getInstance(){
        if(singletion05==null){
            synchronized (Singletion05.class){
                singletion05=new Singletion05();
            }
        }
        return singletion05;
    }
}
